<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>响应式原理</title>
  </head>
  <body>
    <div id="app">
      <ul>
        <li v-for="item in list" :key="item.id">{{ item.value }}</li>
      </ul>
      <button @click="handleClick">按钮</button>
    </div>
    <script src="./vue.js"></script>
    <script>
      new Vue({
        data() {
          return {
            list: [
              {
                id: 1,
                value: 1,
              },
              {
                id: 2,
                value: 2,
              },
              {
                id: 3,
                value: 3,
              },
              {
                id: 4,
                value: 4,
              },
              {
                id: 5,
                value: 5,
              },
              {
                id: 6,
                value: 6,
              },
              {
                id: 7,
                value: 7,
              },
              {
                id: 8,
                value: 8,
              },
            ],
          };
        },
        methods: {
          handleClick() {
            this.list = [
              {
                id: 1,
                value: 1,
              },
              {
                id: 7,
                value: 7,
              },
              {
                id: 4,
                value: 4,
              },
              {
                id: 6,
                value: 6,
              },
              {
                id: 3,
                value: 3,
              },
              {
                id: 5,
                value: 5,
              },
              {
                id: 2,
                value: 2,
              },
              {
                id: 8,
                value: 8,
              },
            ];
          },
        },
      }).$mount("#app");
    </script>
  </body>
</html>
